home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / com / computer / casio_st / prog_fx / oisac2 / l_5230.txt < prev    next >
Text File  |  1994-03-01  |  1KB  |  27 lines

  1. 5 ONERRORGOTO1000:DEFSEG=0
  2. 10 MODE8:DIM:c$=CHR$(5):n=2:x=0:ERASEa,b:m$="Lagrange's interpolation"
  3. 20 CLS:PRINTm$;TAB(0);"1:x       2:set data";
  4. 30 k=VAL(INPUT$(1,@)):ONk GOTO200,60
  5. 40 GOTO30
  6. 60 CLS:PRINT"Number of data";
  7. 70 s$="n":z=n:GOSUB500:n=z:IFw THEN20
  8. 75 IFn<2 ORn>200 ORFRACn<>0 THEN 70
  9. 80 DIMa(n),b(n):LOCATE15,0:PRINT"=";n;
  10. 110 FORi=1 TOn
  11. 120 s$="x"+MID$(STR$(i),2):z=a(i):GOSUB500:IFw THENIFi=1 THEN60 ELSEi=i-1 ELSEa(i)=z
  12. 130 s$="y"+MID$(STR$(i),2):z=b(i):GOSUB500:IFw THEN120 ELSEb(i)=z
  13. 140 NEXT:GOTO20
  14. 200 LOCATE0,1:PRINTc$;"x?";:INPUT@10;z$:LOCATE0,0:IFz$="" THEN20 ELSEx=VALF(z$)
  15. 220 c=0:FORi=1 TOn
  16. 230 p=1:FORj=1 TOn
  17. 240 IFi<>j THENp=p*(x-a(j))/(a(i)-a(j))
  18. 250 NEXT
  19. 260 c=c+p*b(i):NEXT
  20. 280 LOCATE12,1:PRINT":y=";STR$(c);:z$=INPUT$(1,@):GOTO200
  21. 500 LOCATE0,1:PRINTc$;s$;"=";z;"?";:INPUT@10;z:LOCATE0,0:w=PEEK(&H65B)-13:RETURN
  22. 1000 IFERR=1 THENCLS:ONERRORGOTO0
  23. 1010 IFERL=500 THENRESUME500
  24. 1020 IFERL=200 THENRESUME200
  25. 1030 IFERL=80 THENERASEa,b:RESUME80
  26. 1050 LOCATE0,1:PRINTc$;"not found";:z$=INPUT$(1,@):RESUME20
  27.